package com.bving.crawler.controller;

import com.bving.crawler.service.ApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CrawlerController {

    @Autowired
    ApiService apiService;

    @GetMapping("/crawler")
    public String crawlerHtml(){
        String url = "https://www.autohome.com.cn/bestauto/";
        String html = apiService.getHtml(url);
        String result = apiService.crawlerHtml(html);
        return result;
    }

}
